package com.cx.controller.fhy;


import com.cx.pojo.ResultData;
import com.cx.service.fhy.IdentityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("identity")
public class IdentityController {
    @Autowired
    private IdentityService identityService;

    @RequestMapping("updateUser")
    @ResponseBody
    public void updateUser(@RequestParam("userId") Integer userId,
                           @RequestParam("userIdentity") String userIdentity, HttpServletResponse response
                                 )throws IOException {
        int addFieldNum = identityService.updateUser(userId, userIdentity);
        if (addFieldNum > 0) {
            response.sendRedirect("/person.html");
        } else {
            response.sendRedirect("/person.html");
        }
    }
}
